class Shape {
    constructor() {
        this.stroke = '#ff0000';
        this.fill = '#0000ff';
        this.lineWidth = 1;
        this.draggable = true;
        this.visible = true;
    }
    begin(ctx) {
        if (!this.visible) {
            return;
        }
        ctx.save();
        ctx.strokeStyle = this.stroke;
        ctx.fillStyle = this.fill;
        ctx.lineWidth = this.lineWidth;
        ctx.beginPath();
    }
    end(ctx) {
        if (this.lineWidth > 0) {
            ctx.stroke();
        }
        ctx.closePath();
        ctx.fill();
        ctx.restore();
    }
    update() {
        let scene = this._scene;
        let activeElement = scene.activeElement;
        if (this.draggable) {
            if (activeElement) {
                activeElement.x = scene.mouse.x - scene.activeElementOffsetX
                activeElement.y = scene.mouse.y - scene.activeElementOffsetY
            }
        }
    }
    setCenter(x, y) {
        this.x = x;
        this.y = y;
    }
}